package com.xopencode.base64;

import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Optional;

/**
 * @author Mcb
 * @date 2022/5/11
 * @apiNote base64 可以加解码字符串同时还能处理url
 */
public class Test01 {
    public static void main(String[] args) {
        String str = "Hello JAVA";
        //编码
        String encodeToString = Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8));
        System.out.println(encodeToString);
        //解码
        byte[] decode = Base64.getDecoder().decode(encodeToString.getBytes(StandardCharsets.UTF_8));
        System.out.println("解码结果："+new String(decode));

        System.out.println(4%5);

    }
}
